﻿using BLL;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace yuejilalala
{
    public partial class search : System.Web.UI.Page
    {
        string name = "";
        int typeName = 0;
        int storeName = 0;
        ProductMarager Product = new ProductMarager();
        StoreMarager store = new StoreMarager();
        ProductTypeMarager ProductType = new ProductTypeMarager();

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                string name = Request.QueryString["name"];
                TextBox1.Text = name;
                Repeater4.DataSource = Product.GetProductCount3(TextBox1.Text);
                Repeater4.DataBind();

                Repeater2.DataSource = ProductType.GetProductCount2();
                Repeater2.DataBind();

                Repeater3.DataSource = store.StoreCount();
                Repeater3.DataBind();

                Repeater1.DataSource = Product.GetProductCount6();
                Repeater1.DataBind();
            }



        }

        protected void Repeater1_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            string name1 = e.CommandArgument.ToString();
            name1 = name;
            Repeater4.DataSource = Product.GetProductCounts2(TextBox1.Text, typeName, storeName, name);
            Repeater4.DataBind();
        }

        protected void Repeater2_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            int typeName1 = int.Parse(e.CommandArgument.ToString());
            typeName1 = typeName;
            Repeater4.DataSource = Product.GetProductCounts2(TextBox1.Text, storeName, typeName1, name);
            Repeater4.DataBind();
        }

        protected void Repeater3_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            int storeName1 = int.Parse(e.CommandArgument.ToString());
            storeName1 = storeName;
            Repeater4.DataSource = Product.GetProductCounts2(TextBox1.Text, storeName1, typeName, name);
            Repeater4.DataBind();
        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            Repeater4.DataSource = Product.GetProductCount3(TextBox1.Text);
            Repeater4.DataBind();
        }
    }
}

